package com.moyu.common.core.utils;

import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.Random;

/**
 * @Author 赵彦博
 * @Date 2024/12/31 14:25
 */
@Data
@Component
public class EmailCodeUtils {

    public String code;

    public String init() {
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        while (stringBuilder.length() < 6){
            int c = random.nextInt(10);
            stringBuilder.append(c);
        }
        code = stringBuilder.toString();
        return code;
    }
}
